#l#cfinclude template="qry.cfm" />
#l#cfset CurrentPage=GetFileFromPath(GetTemplatePath())>

#l#cfparam name="PageNum_rs_#tabName(Table_Name)#" default="1" />
#l#cfset MaxRows_rs_#tabName(Table_Name)#=50 />
#l#cfif isDefined("attributes.recsPerPage")>
	#l#cfset MaxRows_rs_#tabName(Table_Name)# = attributes.recsPerPage />
#l#/cfif>
#l#cfset StartRow_rs_#tabName(Table_Name)#=Min((PageNum_rs_#tabName(Table_Name)#-1)*MaxRows_rs_#tabName(Table_Name)#+1,Max(rs_#tabName(Table_Name)#.RecordCount,1)) />
#l#cfset EndRow_rs_#tabName(Table_Name)#=Min(StartRow_rs_#tabName(Table_Name)#+MaxRows_rs_#tabName(Table_Name)#-1,rs_#tabName(Table_Name)#.RecordCount) />
#l#cfset TotalPages_rs_#tabName(Table_Name)#=Ceiling(rs_#tabName(Table_Name)#.RecordCount/MaxRows_rs_#tabName(Table_Name)#) />
#l#!--- paging through recs --->
#l#cfset QueryString_rs_#tabName(Table_Name)#=Iif(CGI.QUERY_STRING NEQ "",DE("&"&XMLFormat(CGI.QUERY_STRING)),DE(""))>
#l#cfset tempPos=ListContainsNoCase(QueryString_rs_#tabName(Table_Name)#,"PageNum_rs_#tabName(Table_Name)#=","&")>
#l#cfif tempPos NEQ 0>
	#l#cfset QueryString_rs_#tabName(Table_Name)#=ListDeleteAt(QueryString_rs_#tabName(Table_Name)#,tempPos,"&")>
#l#/cfif>

#l#!--- page navigation --->
#l#cfsavecontent variable="pageNav">
<table class="pageNav">
	#l#cfoutput>
		<tr>
			<td>#l#cfif PageNum_rs_#tabName(Table_Name)# GT 1>
				<a href="##CurrentPage##?PageNum_rs_#tabName(Table_Name)#=1##QueryString_rs_#tabName(Table_Name)###">#l#/cfif>First</a>
			
			</td>
			<td>#l#cfif PageNum_rs_#tabName(Table_Name)# GT 1>
				<a href="##CurrentPage##?PageNum_rs_#tabName(Table_Name)#=##Max(DecrementValue(PageNum_rs_#tabName(Table_Name)#),1)####QueryString_rs_#tabName(Table_Name)###">#l#/cfif>Previous</a>
			
			</td>
			<td>#l#cfif PageNum_rs_#tabName(Table_Name)# LT TotalPages_rs_#tabName(Table_Name)#>
				<a href="##CurrentPage##?PageNum_rs_#tabName(Table_Name)#=##Min(IncrementValue(PageNum_rs_#tabName(Table_Name)#),TotalPages_rs_#tabName(Table_Name)#)####QueryString_rs_#tabName(Table_Name)###">#l#/cfif>Next</a>
			
			</td>
			<td>#l#cfif PageNum_rs_#tabName(Table_Name)# LT TotalPages_rs_#tabName(Table_Name)#>
				<a href="##CurrentPage##?PageNum_rs_#tabName(Table_Name)#=##TotalPages_rs_#tabName(Table_Name)#####QueryString_rs_#tabName(Table_Name)###">#l#/cfif>Last</a>
			
			</td>
		</tr>
	#l#/cfoutput>
</table>
#l#/cfsavecontent>

<cfoutput><cfif is_identity eq 'Y'>
#l#cfoutput>#l#a href="frm_modify.cfm?#column_name#=0" class="button" accesskey="N">New #dspFormat(column_name)##l#/a>#l#/cfoutput></cfif></cfoutput>

#l#cfoutput>##pageNav###l#/cfoutput>

<table class="sortable report">
	<caption>
	#l#cfoutput>Records ##NumberFormat(StartRow_rs_#tabName(Table_Name)#)## to ##NumberFormat(EndRow_rs_#tabName(Table_Name)#)## of ##NumberFormat(rs_#tabName(Table_Name)#.RecordCount)## #l#/cfoutput>
	</caption>
	<thead>
		<tr>
			<cfoutput><cfif is_identity eq 'Y'>#l#cfif isAdmin()><th sort="false">act</th>#l#/cfif><cfelse><th>#dspFormat(column_name)#</th></cfif>
			</cfoutput>
		</tr>
	</thead>
	<tbody>
		#l#cfoutput query="rs_#tabName(Table_Name)#" startRow="##StartRow_rs_#tabName(Table_Name)###" maxRows="##MaxRows_rs_#tabName(Table_Name)###">
			<tr>
				<cfoutput>
				<cfif is_identity eq 'Y'>#l#cfif isAdmin()>
				<td>
				<a href="frm_modify.cfm?#column_name#=##rs_#tabName(Table_Name)#.#column_name###" class="update icon" title="update" />update</a>
				<a href="act_delete.cfm?#column_name#=##rs_#tabName(Table_Name)#.#column_name###" onClick="return confirmDelete();" class="delete icon" title="delete" />delete</a>
				</td>
				#l#/cfif>
				<cfelse><td<cfif data_type CONTAINS "datetime"
						OR data_type CONTAINS "int"> class="numeric"</cfif>><cfif data_type CONTAINS "datetime">##LSDateFormat(rs_#tabName(Table_Name)#.#column_name#,request.dtFrmt)##<cfelse>##rs_#tabName(Table_Name)#.#column_name###</cfif></td>
				</cfif></cfoutput>
			</tr>
		#l#/cfoutput>
	</tbody>
</table>

#l#cfoutput>##pageNav###l#/cfoutput>